<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>后台管理系统 - 登录</title>
    <style>
        body {
            margin: 0;
            height: 100vh;
            display: flex;
            align-items: center;
            justify-content: center;
            background: linear-gradient(135deg, #4e54c8, #8f94fb);
            font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial;
        }

        .login-container {
            background: white;
            padding: 40px;
            border-radius: 10px;
            box-shadow: 0 0 20px rgba(0, 0, 0, 0.1);
            width: 400px;
            text-align: center;
        }

        .login-title {
            font-size: 24px;
            color: #333;
            margin-bottom: 30px;
        }

        .login-form {
            display: flex;
            flex-direction: column;
            gap: 20px;
        }

        .form-group {
            position: relative;
        }

        .form-group input {
            width: 100%;
            padding: 12px;
            border: 1px solid #ddd;
            border-radius: 5px;
            font-size: 16px;
            box-sizing: border-box;
        }

        .login-btn {
            background: #4e73df;
            color: white;
            border: none;
            padding: 12px;
            border-radius: 5px;
            font-size: 16px;
            cursor: pointer;
            transition: background 0.3s;
        }

        .login-btn:hover {
            background: #2e59d9;
        }

        .system-logo {
            width: 120px;
            height: auto;
            margin-bottom: 30px;
            object-fit: contain;
        }

        .error-message {
            color: #dc3545;
            font-size: 14px;
            margin-top: 10px;
            display: none;
        }
    </style>
</head>
<body>
    <div class="login-container">
        <img src="//at.alicdn.com/t/c/font_4373611_kq19ee4ry1.png" alt="系统Logo" class="system-logo">
        <h1 class="login-title">后台管理系统</h1>
        <form class="login-form" onsubmit="return handleLogin(event)">
            <div class="form-group">
                <input type="text" id="username" placeholder="请输入用户名" required>
            </div>
            <div class="form-group">
                <input type="password" id="password" placeholder="请输入密码" required>
            </div>
            <div class="error-message" id="errorMessage">密码错误，请重试</div>
            <button type="submit" class="login-btn">登录</button>
        </form>
    </div>

    <script>
        function handleLogin(event) {
            event.preventDefault();
            
            const username = document.getElementById('username').value;
            const password = document.getElementById('password').value;
            const errorMessage = document.getElementById('errorMessage');

            if (password === '123456') {
                // 登录成功，存储登录状态
                localStorage.setItem('isLoggedIn', 'true');
                localStorage.setItem('username', username);
                
                // 跳转到主页面
                window.location.href = 'index.html';
            } else {
                // 显示错误信息
                errorMessage.style.display = 'block';
                
                // 3秒后隐藏错误信息
                setTimeout(() => {
                    errorMessage.style.display = 'none';
                }, 3000);
            }

            return false;
        }

        // 检查是否已登录
        window.onload = function() {
            if (localStorage.getItem('isLoggedIn') === 'true') {
                window.location.href = 'index.html';
            }
        }
    </script>
</body>
</html>